﻿/*
 * This software is the confidential and proprietary
 * information of NetBay
 * Such confidential information should not be disclosed
 * NetBay copyright(c) 2010
 */

#region Using
using System;
using System.Text;
using System.Runtime.Serialization;
#endregion

namespace NetBay.Core.BusinessEntities
{
    /// <summary>
    /// Class handle a item
    /// </summary>
    [DataContract]
    public class Item : ReturnObject
    {

        #region Enums
        #endregion

        #region Constants
        #endregion

        #region Attributes
        private long m_lIdentifier;
        private string m_szName;
        private string m_szCode;
        #endregion

        #region Init/Constructor

        /// <summary>
        /// Full constructor
        /// </summary>
        /// <param name="p_lIdentifier">Identifier of item</param>
        /// <param name="p_szName">Name of item</param>
        /// <param name="p_szCode"></param>
        public Item(long p_lIdentifier, string p_szName, string p_szCode = "")
        {
            Identifier = p_lIdentifier;
            Name = p_szName;
            Code = p_szCode;
        }

        /// <summary>
        /// Default constructor
        /// </summary>
        public Item()
            : this(0, "") { }

        /// <summary>
        /// Only for error
        /// </summary>
        /// <param name="ErrorMessage"></param>
        public Item(string errorMessage, Exception applicationException = null)
            : base(errorMessage, applicationException)
        {
        }

        #endregion


        #region Functions

        #region Publics
        [DataMember]
        public long Identifier
        {
            get { return m_lIdentifier; }
            set { m_lIdentifier = value; }
        }

        [DataMember]
        public string Name
        {
            get { return m_szName; }
            set { m_szName = value; }
        }

        [DataMember]
        public string Code
        {
            get { return m_szCode; }
            set { m_szCode = value; }
        }
        #endregion

        #region Privates
        #endregion

        #region ToString
        /// <summary>
        /// Extend default description of class
        /// </summary>
        /// <returns>description of instance</returns>
        public override string ToString()
        {
            StringBuilder parameters = new StringBuilder("Identifier<", 4096);
            parameters.Append(Identifier); parameters.Append("> ");
            parameters.Append("Name<"); parameters.Append(Name); parameters.Append("> ");
            parameters.Append("Code<"); parameters.Append(Code); parameters.Append("> ");

            return parameters.ToString();
        }

        #endregion

        #endregion

        public override object Clone()
        {
            throw new NotImplementedException();
        }
    }

    public abstract class ItemDer : Item
    {

    }
}
